import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ArticleListVo, ArticleVo } from './types';

/**
 * @description 钓鱼小知识分页列表
 * @param query 
 * @returns 
 */
export const articlesList = (query?: any): AxiosPromise<ArticleListVo<ArticleVo>> => {
    return request({
      url: '/api/articles/list',
      method: 'get',
      params: query
    });
};

/**
 * @description 钓鱼小知识热榜数据
 * @param query 
 * @returns 
 */
export const articlesHotList = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/articles/hot',
      method: 'get',
      params: query
    });
};

/**
 * @description 钓鱼小知识获取详情
 * @param query 根据articleId查单条详情
 * @returns 
 */
export const articlesDetail = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/articles/detail',
      method: 'get',
      params: query
    });
};

/**
 * @description 修改浏览量
 * @param query 根据articleId查单条浏览量
 * @returns 
 */
export const articlesDetailView = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/articles/view',
      method: 'post',
      data: query
    });
};

///ai/chat/stream接口
// export const aiChatStream = (input: string): AxiosPromise => {
//     return request({
//         url: '/ai/chat/stream',
//         method: 'get',
//         params: { input },
//         responseType: 'stream',
//         headers: {
//             'Accept': 'text/event-stream',
//             'Cache-Control': 'no-cache',
//         },
//     });
// };

